from django.conf.urls.defaults import *
from webmapper import photoviews, views, models

urlpatterns = patterns('webmapper.views',
    (r'^$', views.homeView, {}, "home-view"),
    (r'^dashboard.html$', views.dashboard, {}, "dashboard"),
    # URLs that Hig and I Discussed...
    (r'^map/mapsnaps/(?P<uniqueName>[A-Za-z0-9_]+).html$', views.map.viewSnap, {}, "map-snap"),
    (r'^map/view/(?P<uniqueName>[A-Za-z0-9_]+).html$', views.map.viewOverview, {}, "map-view"),
    (r'^map/mapinfo/(?P<uniqueName>[A-Za-z0-9_]+).html$', views.map.viewInfo, {}, "map-info"),
    
    # URLs that support Phase 1 (static layers)
    (r'^layer/uploadkml.html$', views.layer.uploadKml, {}, "layer-kml-upload"),
    (r'^layer/(?P<id>\d+)/edit.html$', views.layer.edit, {}, "layer-edit"),
    (r'^map/create.html$', views.map.create, {}, "map-create"),
    (r'^map/(?P<id>\d+)/edit.html$', views.map.edit, {}, "map-edit"),
    (r'^mapkey/create.html$', views.mapKey.create, {}, "mapkey-create"),
    (r'^mapkey/(?P<id>\d+)/edit.html$', views.mapKey.edit, {}, "mapkey-edit"),

    # URLs to support Phase 2 (dynamic MapLayer)
    (r'^layer/(?P<uniqueName>[A-Za-z0-9_]+).kml$', views.Kml.mapLayer, {}, "layer-kml"),
    
    # My Old URLs
    (r'^route/(?P<id>\d+).kml$', views.Kml.mapObject, {'map_object': models.Route}, "route-kml"),
    (r'^route/(?P<id>\d+)/map.html$', views.mapPage, {'map_object': models.Route}, "route-map"),
    (r'^route/(?P<id>\d+)/embedmap.html$', views.embedKmlMap, {'map_object': models.Route}, "route-map-embed"),
    (r'^route/upload.html$', views.uploadRoute, {}, "route-upload"),
    (r'^area/(?P<id>\d+).kml$', views.Kml.mapObject, {'map_object': models.Area}, "area-kml"),
    (r'^area/(?P<id>\d+)/map.html$', views.mapPage, {'map_object': models.Area}, "area-map"),
    (r'^area/(?P<id>\d+)/embedmap.html$', views.embedKmlMap, {'map_object': models.Area}, "area-map-embed"),
    (r'^poi/(?P<id>\d+).kml$', views.Kml.mapObject, {'map_object': models.PointOfInterest}, "poi-kml"),
    (r'^poi/(?P<id>\d+)/map.html$', views.mapPage, {'map_object': models.PointOfInterest}, "poi-map"),
    (r'^poi/(?P<id>\d+)/embedmap.html$', views.embedKmlMap, {'map_object': models.PointOfInterest}, "poi-map-embed"),
    
    # Photo-related views...
    (r'^photo/(?P<id>\d+).kml$', views.Kml.mapObject, {'map_object': models.Photo}, "photo-kml"),
    (r'^photo/(?P<id>\d+)/map.html$', views.mapPage, {'map_object': models.Photo}, "photo-map"),
    (r'^photo/(?P<id>\d+)/embedmap.html$', views.embedKmlMap, {'map_object': models.Photo}, "photo-map-embed"),
    (r'^photo/IMG_(?P<id>\d+).html$', photoviews.photoPage, {}, "photo-page"),
    (r'^photo/IMG_(?P<id>\d+)-Title.html$', photoviews.photoPageTitle, {}, "photo-page-title"),
)
